package ch.ebnoether.controller;

import java.awt.event.MouseEvent;

import javax.swing.JTextField;

import ch.ebnoether.gui.WinnerCardRight;
import ch.ebnoether.gui.YatzyGUI;
import ch.ebnoether.wuerfel.Dice;

public class FullHouseController extends MasterController {

  private Dice[] dices;
  private WinnerCardRight rechts;

  public FullHouseController(Dice[] dices, WinnerCardRight rechts, YatzyGUI yatzi) {
    super(dices, yatzi);
    this.dices = dices;
    this.rechts = rechts;
  }

  /*
     * (non-Javadoc)
     *
     * @see
     * ch.ebnoether.controller.ControllerRechts#mouseClicked(java.awt.event.
     * MouseEvent)
     */
  @Override
  public void mouseClicked(MouseEvent e) {
    Object o = e.getSource();
    JTextField t = (JTextField) o;

    if (!super.isGesetzt() && MasterController.setzbar) {
      t.setText("" + ControllerLogik.fullHouseBerechnen(this.dices));
      ControllerLogik.setTotalRechts(this.rechts, Integer.valueOf(t.getText()));
      super.mouseClicked(e);
    }
  }

  /*
     * (non-Javadoc)
     *
     * @see
     * ch.ebnoether.controller.ControllerRechts#mouseEntered(java.awt.event.
     * MouseEvent)
     */
  @Override
  public void mouseEntered(MouseEvent e) {
    Object o = e.getSource();
    JTextField t = (JTextField) o;

    if (!super.isGesetzt() && MasterController.setzbar) {
      t.setText("" + ControllerLogik.fullHouseBerechnen(this.dices));
    }
  }

}
